package com.toocms.jinjuhang.ui.mine.management_system

import android.graphics.drawable.Drawable
import android.os.Bundle
import androidx.databinding.ObservableField
import com.toocms.jinjuhang.ui.base.BaseFgt
import com.toocms.tab.base.BaseViewModel
import com.toocms.tab.base.ItemViewModel
import com.toocms.tab.binding.command.BindingAction
import com.toocms.tab.binding.command.BindingCommand

class ManagementSystemFunctionItemModel(
    viewModel: BaseViewModel<*>,
    val iconObservableField: ObservableField<Drawable>,
    val titleObservableField: ObservableField<String>,
    val openFgt: Class<out BaseFgt<*, *>>? = null,
    val bundle: Bundle? = null,
    clickBindingCommand: (BindingCommand<BindingAction>) = BindingCommand<BindingAction>(
        BindingAction {
            if (null == openFgt) return@BindingAction
            viewModel.startFragment(openFgt, bundle)
        })
) :
    ItemViewModel<BaseViewModel<*>>(viewModel) {


    val itemClickBindingCommand: (BindingCommand<BindingAction>) = BindingCommand<BindingAction>(
        BindingAction {
            clickBindingCommand.execute()
        })
    }